package com.songjg.demo.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.songjg.demo.dao.first.TbUserMapper;
import com.songjg.demo.dao.second.UserMapper;
import com.songjg.demo.entity.first.TbUser;
import com.songjg.demo.entity.second.UserPo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: song.jingen
 * @create: 2019/7/19 16:52
 **/
@Service
public class UserService {

    @Resource
    private UserMapper userMapper;
    @Resource
    private TbUserMapper tbUserMapper;

    public List<UserPo> userList() {
        //进行分页
        Page<Object> page = PageHelper.startPage(1, 1);
        List<UserPo> userPos = userMapper.userList();
        //获取总条数
        long total = page.getTotal();
        return userPos;
    }
    public TbUser tbUser(Integer id) {
        return tbUserMapper.selectByPrimaryKey(id);
    }
}
